<% source = payment.source %>
<div class="d-flex flex items-top gap-2">
  <% if source.is_a?(Spree::CreditCard) %>
    <div class="flex-shrink-0">
      <% # display wallet icon, eg. Apple Pay, Google Pay, etc. %>
      <%= payment_method_icon_tag source.wallet_type, height: 30 if source.try(:wallet_type).present? %>
      <% # display card type icon, eg. Visa, Mastercard, etc. %>
      <%= payment_method_icon_tag source.cc_type, height: 30 %>
    </div>
    <div>
      <p class="mb-1"><%= Spree.t(:ending_with) %> <%=source.last_digits %></p>
      <p class="mb-0"><%= Spree.t(:expires) %> <%= source.month %> / <%= source.year %></p>
    </div>
  <% elsif source.is_a?(Spree::StoreCredit) %>
    <% if source.gift_card %>
      <div class="d-flex flex rounded bg-light px-3 py-2 mb-3 align-items-center">
        <%= icon('gift', height: 30, class: 'mr-3 text-muted') %>
        <div>
          <p class="mb-1">Gift card: <strong><%= source.gift_card.code.upcase %></strong></p>
          <%= @order.display_gift_card_total %>
        </div>
      </div>
    <% else %>
      <div class="rounded bg-light px-3 py-2 mb-3">
        <%= Spree.t(:store_credits) %>: <%= @order.display_total_applied_store_credit.abs %>
      </div>
    <% end %>
  <% elsif source.present? %>
    <div class="flex-shrink-0">
      <%= payment_method_icon_tag source.class.to_s.demodulize.downcase, height: 30 %>
    </div>
  <% else %>
    <div class="flex-shrink-0">
      <%= payment_method_icon_tag payment.payment_method.payment_icon_name %>
    </div>
    <div>
      <%= payment.payment_method.name %>
    </div>
  <% end %>
</div>
